You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix removeEvent for native Shiny input containers - #283
Type a key, click Remove, and type again: the supposedly removed callback still updates the output. Removing by event type has the same problem.
Attachment deliberately resolves native inputs to their .shiny-input-container, storing the handler IDs there. Removal looks for those IDs on the input itself and therefore leaves the handler active.
Change
Use the same existing container resolution in the existing-element removal path. This preserves selective instance removal, event-type removal, ordinary HTML elements and the queued dynamic-element path. Add a module fixture/regression covering instance removal without disturbing a second handler, removal by type, and ordinary paragraph events.
Validation
R 4.3.3 / Shiny 1.8.0 / Chrome, real loopback Shiny sessions with normal DOM clicks/keypresses: base fails, patched code passes.
The added fixture was exercised in Chrome using Playwright: on base the first/second input callbacks reach 3/3 despite removal, while patched values remain 1/2. Plain paragraph removal continues working; module namespaces are covered.
Guide form and two-module visibility/state/reset/onclick flows plus extension initialization/parameters also pass in the real Shiny browser runtime.
Source install, JavaScript syntax and diff checks pass.
R CMD build --no-build-vignettes --no-manual and R CMD check --no-manual --no-vignettes with _R_CHECK_FORCE_SUGGESTS_=false: no errors; two warnings about unbuilt vignette outputs and one note for unavailable suggested packages (rmarkdown, shinyAce, shinydisconnect, shinytest2). Non-browser tests pass; the shinytest2 runner itself and full cross-platform/vignette checks were not run locally.
Summary by CodeRabbit
Bug Fixes
Event handlers can now be reliably removed from Shiny inputs, including individual handlers and all handlers of a specified type.
Tests
Added coverage for removing input and element event handlers and verifying the resulting behavior.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
📝 Walkthrough
removeEvent now resolves existing targets to the Shiny input container used by event attachment before accessing event data. A Shiny app test checks removal of a single handler by ID and removal of all handlers by event type.
Changes: Event handler removal
Layer / File(s)
Summary
Resolve targets and test handler removal inst/srcjs/shinyjs-default-funcs.js, tests/testthat/apps/remove-events/*
removeEvent resolves an existing target to its Shiny input container. The test app registers click handlers and checks their outputs after removing one handler or all handlers.
No actionable merge-blocking risk is identified. The change appears ready to merge after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: fixing removeEvent behavior for native Shiny input containers.
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit taps the input twice Then asks one handler not to play The rest keep counting as before A second click says more, hooray All click handlers pause their dance The rabbit checks the count once more
Comment @coderabbitai help to get the list of available commands.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
removeEvent()does not remove handlers registered on native Shiny inputs such astextInput():Type a key, click Remove, and type again: the supposedly removed callback still updates the output. Removing by event type has the same problem.
Attachment deliberately resolves native inputs to their
.shiny-input-container, storing the handler IDs there. Removal looks for those IDs on the input itself and therefore leaves the handler active.Change
Use the same existing container resolution in the existing-element removal path. This preserves selective instance removal, event-type removal, ordinary HTML elements and the queued dynamic-element path. Add a module fixture/regression covering instance removal without disturbing a second handler, removal by type, and ordinary paragraph events.
Validation
R CMD build --no-build-vignettes --no-manualandR CMD check --no-manual --no-vignetteswith_R_CHECK_FORCE_SUGGESTS_=false: no errors; two warnings about unbuilt vignette outputs and one note for unavailable suggested packages (rmarkdown,shinyAce,shinydisconnect,shinytest2). Non-browser tests pass; the shinytest2 runner itself and full cross-platform/vignette checks were not run locally.Summary by CodeRabbit